Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support event APIs #339

Merged
merged 19 commits into from
Sep 20, 2023
Merged

Support event APIs #339

merged 19 commits into from
Sep 20, 2023

Conversation

jkrvivian
Copy link
Contributor

@jkrvivian jkrvivian commented Sep 7, 2023

Changes are also made in:

inx-mqtt docker image can be packed and successfully tested in docker-network.

Close #227

@jkrvivian jkrvivian marked this pull request as ready for review September 8, 2023 06:32
components/restapi/params.go Outdated Show resolved Hide resolved
components/inx/server_blocks.go Outdated Show resolved Hide resolved
components/inx/server_blocks.go Outdated Show resolved Hide resolved
components/inx/server_blocks.go Outdated Show resolved Hide resolved
components/inx/server_node.go Outdated Show resolved Hide resolved
components/inx/server_node.go Outdated Show resolved Hide resolved
func (s *Server) ReadOutputMetadata(_ context.Context, id *inx.OutputId) (*inx.OutputMetadata, error) {
outputID := id.Unwrap()

output, spent, err := deps.Protocol.MainEngineInstance().Ledger.OutputOrSpent(outputID)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhh so we don't have any info about the latest commitment in the Ledger?
Because between fetching the output from the ledger, and reading the latestCommitment from the SyncManager.... there could be a change. We need this info atomically.
Otherwise we return the wrong latestCommitmentId.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we only have it in Storage and SyncManager. 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ledgerstate has the index, but when we read this we go through the mempool which has a potentially newer state than the ledgerstate. That is why it is important to compare the slot indexes in the output metadata with the latest commitment of the node, that way you will see if the output was committed or if it is still just in the mempool

components/inx/server_commitments.go Outdated Show resolved Hide resolved
components/inx/server_commitments.go Outdated Show resolved Hide resolved
components/inx/server_commitments.go Outdated Show resolved Hide resolved
@muXxer muXxer merged commit 4a310a3 into develop Sep 20, 2023
@muXxer muXxer deleted the feat/inx-mqtt branch September 20, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event API (MQTT)
3 participants